package com.vcg.community.common.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JDBCUtils {
	
	static{
		try {
			Class.forName("net.sourceforge.jtds.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		
	}
	
	// 获得连接
	public static Connection getConnection(String URL, String UserName,String Password) {
		Connection conn = null;
		try {
			conn = DriverManager.getConnection(URL, UserName, Password);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return conn;
	}
	
	public static Connection getGicCrmConnection(){
		return JDBCUtils.getConnection("jdbc:jtds:sqlserver://192.168.0.15:1433/GICCrm","fine", "fine");
	}
	
	public static Connection getCrmConnection(){
		return JDBCUtils.getConnection("jdbc:jtds:sqlserver://192.168.0.15:1433/crm","fine", "fine");
	}
	
	public static Connection getLocalGicCrmConnection(){
		return JDBCUtils.getConnection("jdbc:jtds:sqlserver://localhost:1433/gicrm","sa", "wknimagnim");
	}
	
	public static Connection getUserCenterConnection(){
		return JDBCUtils.getConnection("jdbc:mysql://localhost/user_center","root","root");
	}
	
}
